home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / MacX25 / MacX25 Developer's Kit / X.25_Interface_Library / Library / Interfaces / CIncludes / X25_Packet.h < prev   
Encoding:
C/C++ Source or Header  |  1994-11-21  |  11.3 KB  |  164 lines  |  [TEXT/MPS ]

  1. /* ******************************************************************************************** */
  2. /* *                                                                                          * */
  3. /* *                              X.25 Interface Library                                      * */
  4. /* *                              ----------------------                                      * */
  5. /* *                                                                                          * */
  6. /* *                                    X25_Packet.h                                          * */
  7. /* *                                                                                          * */
  8. /* *..........................................................................................* */
  9. /* *                                                                                          * */
  10. /* *     X.25 Packet Format Definitions.                                                      * */
  11. /* *                                                                                          * */
  12. /* *                                                                                          * */
  13. /* *------------------------------------------------------------------------------------------* */
  14. /* *                                                                                          * */
  15. /* *                   Copyright © 1988-1990 Apple Computer, Inc.                             * */
  16. /* *                               All Rights Reserved                                        * */
  17. /* *                                                                                          * */
  18. /* *------------------------------------------------------------------------------------------* */
  19. /* *                                                                                          * */
  20. /* *     Revision History:                                                                    * */
  21. /* *                                                                                          * */
  22. /* *     Date       Individual          Changes                                               * */
  23. /* *     .........  ................... ..................................................    * */
  24. /* *                                                                                          * */
  25. /* *     15 Aug 88  D. N. Willey        Original Version                                      * */
  26. /* *                                                                                          * */
  27. /* *                                                                                          * */
  28. /* ******************************************************************************************** */
  29.  
  30.  
  31. #ifndef     _X25_Packet_Includes_
  32. #define     _X25_Packet_Includes_
  33.  
  34.  
  35.  
  36. /* ******************************************************************************************** */
  37. /* *                                                                                          * */
  38. /* *    General X.25 Packet Definitions                                                       * */
  39. /* *                                                                                          * */
  40. /* ******************************************************************************************** */
  41.  
  42. /* +------------------------------------------------------------------------------------------+ */
  43. /* |                                                                                          | */
  44. /* |    General Packet Structure Definition                                                   | */
  45. /* |                                                                                          | */
  46. /* +------------------------------------------------------------------------------------------+ */
  47.  
  48. #define packet(data_len)                                                                        \
  49.                                                                                                 \
  50. struct {                                                                                        \
  51.                                         /* General Format Identifier          (left nibble) */  \
  52.     unsigned        Q_bit       : 1;    /*     Qualified Data Transmission                  */  \
  53.     unsigned        D_bit       : 1;    /*     Delivery Confirmation Notification           */  \
  54.     unsigned        modulo      : 2;    /*     Sequence Number Modulo                       */  \
  55.     unsigned        l_c_g       : 4;    /* Logical Channel Group Number      (right nibble) */  \
  56.     unsigned        l_c_n       : 8;    /* Logical Channel Number                           */  \
  57.     unsigned        pkt_type    : 8;    /* Packet Type Identifier                           */  \
  58.     unsigned char   pkt_data[data_len]; /* Begining of the Variable Packet Data Field       */  \
  59.     }
  60.  
  61. #define L_bit       Q_bit
  62.  
  63. /* +------------------------------------------------------------------------------------------+ */
  64. /* |                                                                                          | */
  65. /* |    Packet Types                                                                          | */
  66. /* |                                                                                          | */
  67. /* +------------------------------------------------------------------------------------------+ */
  68.  
  69.  
  70. #define     X25_Call_Request_Pkt        0x0B
  71. #define     X25_Call_Accepted_Pkt       0x0F
  72.  
  73. #define     X25_Clear_Pkt               0x13
  74. #define     X25_Clear_Conf_Pkt          0x17
  75.  
  76. #define     X25_Data_Pkt                0x00
  77.  
  78. #define     X25_Interrupt_Pkt           0x23
  79. #define     X25_Interrupt_Conf_Pkt      0x27
  80.  
  81. #define     X25_Reset_Pkt               0x1B
  82. #define     X25_Reset_Conf_Pkt          0x1F
  83.  
  84. #define     X25_Restart_Pkt             0xFB
  85. #define     X25_Restart_Conf_Pkt        0xFF
  86.  
  87. #define     X25_Diagnostic_Pkt          0xF1
  88.  
  89. #define     X25_Registration_Pkt        0xF3
  90. #define     X25_Registration_Conf_Pkt   0xF7
  91.  
  92.  
  93. /* ******************************************************************************************** */
  94. /* *                                                                                          * */
  95. /* *    Call Facility Codes                                                                   * */
  96. /* *                                                                                          * */
  97. /* ******************************************************************************************** */
  98.  
  99. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  100. /* +                                                                                          + */
  101. /* +    X.25 Call Facility Indicator Codes                                                    + */
  102. /* +                                                                                          + */
  103. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  104.  
  105. #define     F_CUG_BASIC             0x03    /* closed user group         - basic    (2 digits)  */
  106. #define     F_CUG_EXT               0x47    /* closed user group         - extended (4 digits)  */
  107. #define     F_CUG_OA_BASIC          0x09    /* cug with outgoing access  - basic    (2 digits)  */
  108. #define     F_CUG_OA_EXT            0x48    /* cug with outgoing access  - extended (4 digits)  */
  109. #define     F_BCUG                  0x41    /* bilateral closed user group                      */
  110. #define     F_REV_CHARG             0x01    /* reverse charging                                 */
  111. #define     F_RPOA_BASIC            0x44    /* RPOA transit netmork selection - (1 address)     */
  112. #define     F_RPOA_EXT              0xC4    /* RPOA transit netmork selection - (n addresss)    */
  113. #define     F_CHARG_INFO            0x04    /* charging information                             */
  114. #define     F_NUI                   0xC6    /* network user identification                      */
  115. #define     F_PKT_SIZE_NEG          0x42    /* Packet Size Negotiation                          */
  116. #define     F_WND_SIZE_NEG          0x43    /* Window Size Negotiation                          */
  117. #define     F_T_CLASS_NEG           0x02    /* Throughput Class Negotiation                     */
  118. #define     F_TRANSIT_DELAY         0x49    /* Transit Delay Selection and Negotiation          */
  119.  
  120. #define     F_MARKER                0x00    /* Facility Marker                                  */
  121.  
  122.  
  123. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  124. /* +                                                                                          + */
  125. /* +    Call Facility Bits                                                                    + */
  126. /* +                                                                                          + */
  127. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  128.  
  129. #define     FB_REV_CHARG            0x01    /* bit indicating reverse charging                  */
  130. #define     FB_FAST_SEL             0x80    /* bit indicating fast select                       */
  131. #define     FB_FAST_SEL_R           0xC0    /* bit indicating fast select restrictive           */
  132. #define     FB_CHARG_INFO           0x01    /* bit indicating charging info requested           */
  133.  
  134.  
  135. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  136. /* +                                                                                          + */
  137. /* +    CCITT Call Facility Indicator Codes                                                   + */
  138. /* +                                                                                          + */
  139. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  140.  
  141. #define     F_CCITT_CALLED_NSAP     0xC9    /* called nsap                                      */
  142. #define     F_CCITT_CALLING_NSAP    0xCB    /* calling nsap                                     */
  143. #define     F_CCITT_T_CLASS_NEG     0x0A    /* Throughput Class Negotiation                     */
  144. #define     F_CCITT_TRANSIT_DELAY   0xCA    /* Transit Delay Selection and Negotiation          */
  145. #define     F_CCITT_E_DATA_NEG      0x0B    /* Expedited Data Negotiation                       */
  146.  
  147.  
  148. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  149. /* +                                                                                          + */
  150. /* +    Call Facility Bits                                                                    + */
  151. /* +                                                                                          + */
  152. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  153.  
  154. #define     FB_CCITT_E_DATA_NEG     0x01    /* Expedited Data Negotiation                       */
  155.  
  156.  
  157. /* ******************************************************************************************** */
  158. /* *                                                                                          * */
  159. /* *    End                                                                                   * */
  160. /* *                                                                                          * */
  161. /* ******************************************************************************************** */
  162.  
  163. #endif  _X25_Packet_Includes_
  164.